<template>
  <div class="basicdata">
    <h3>从业时间分值设定</h3>
    <hr />
    <el-form
      :model="basicinfoData"
      ref="basicinfoData"
      :inline="true"
      class="demo-form-inline"
    >
      <el-col :span="12">
        <el-form-item
          label="一档："
           prop="hiretimeFirst"
          :rules="[
            { required: true, message: '内容不能为空' },
            { type: 'number', message: '内容必须为数字值' },
          ]"
        >
          <el-input
            v-model.number="basicinfoData.hiretimeFirst"
            placeholder="请输入年限"
            autocomplete="off"
            clearable
          ></el-input>
        </el-form-item>
        <span class="spanStyle">年以上</span>
      </el-col>

      <el-col :span="12">
        <el-form-item
          prop="hiretimeFirstScoring"
          :rules="[
            { required: true, message: '内容不能为空' },
            { type: 'number', message: '内容必须为数字值' },
          ]"
        >
          <el-input
            v-model.number="basicinfoData.hiretimeFirstScoring"
            autocomplete="off"
            placeholder="请输入分值"
            clearable
          ></el-input>
        </el-form-item>
        <span class="spanStyle">分</span>
      </el-col>

      <el-col :span="6">
        <el-form-item
          label="二档："
          prop="hiretimeSecondL"
          :rules="[
            { required: true, message: '内容不能为空' },
            { type: 'number', message: '内容必须为数字值' },
          ]"
        >
          <el-input
            v-model.number="basicinfoData.hiretimeSecondL"
            placeholder="请输入年限"
           autocomplete="off"
           clearable
          ></el-input>
        </el-form-item>
        <span class="spanStyle">年</span>
      </el-col>
      <el-col :span="6">
        <el-form-item
          label="至"
          prop="hiretimeSecondU"
          :rules="[
            { required: true, message: '内容不能为空' },
            { type: 'number', message: '内容必须为数字值' },
          ]"
        >
          <el-input
            v-model.number="basicinfoData.hiretimeSecondU"
            placeholder="请输入年限"
            autocomplete="off"
            clearable
          ></el-input>
        </el-form-item>
        <span class="spanStyle">年</span>
      </el-col>

      <el-col :span="12">
        <el-form-item
          prop="hiretimeSecondScoring"
          :rules="[
            { required: true, message: '内容不能为空' },
            { type: 'number', message: '内容必须为数字值' },
          ]"
        >
          <el-input
            v-model.number="basicinfoData.hiretimeSecondScoring"
            placeholder="请输入分值"
            autocomplete="off"
            clearable
          ></el-input>
        </el-form-item>
        <span class="spanStyle">分</span>
      </el-col>

      <el-col :span="12">
        <el-form-item
          label="三档："
          prop="hiretimeThird"
          :rules="[
            { required: true, message: '内容不能为空' },
            { type: 'number', message: '内容必须为数字值' },
          ]"
        >
          <el-input
            v-model.number="basicinfoData.hiretimeThird"
            placeholder="请输入年限"
            autocomplete="off"
            clearable
          ></el-input>
        </el-form-item>
        <span class="spanStyle">年以下</span>
      </el-col>
      <el-col :span="12">
        <el-form-item
          prop="hiretimeThirdScoring"
          :rules="[
            { required: true, message: '内容不能为空' },
            { type: 'number', message: '内容必须为数字值' },
          ]"
        >
          <el-input
            v-model.number="basicinfoData.hiretimeThirdScoring"
            placeholder="请输入分值"
            autocomplete="off"
            clearable
          ></el-input>
        </el-form-item>
        <span class="spanStyle">分</span>
      </el-col>
      <div class="mbo">
        <h3>普通话分值设定</h3>
        <hr />
      </div>
      <el-col :span="7">
        <el-form-item
          label="高级水平"
          prop="languageFristScoring"
          :rules="[
            { required: true, message: '内容不能为空' },
            { type: 'number', message: '内容必须为数字值' },
          ]"
        >
          <el-input
            v-model.number="basicinfoData.languageFristScoring"
            placeholder="请输入分值"
            autocomplete="off"
            clearable
          ></el-input>
        </el-form-item>
        <span class="spanStyle">分</span>
      </el-col>
      <el-col :span="7">
        <el-form-item
          label="中级水平"
          prop="languageSecondScoring"
          :rules="[
            { required: true, message: '内容不能为空' },
            { type: 'number', message: '内容必须为数字值' },
          ]"
        >
          <el-input
            v-model.number="basicinfoData.languageSecondScoring"
            placeholder="请输入分值"
            autocomplete="off"
            clearable
          ></el-input>
        </el-form-item>
        <span class="spanStyle">分</span>
      </el-col>
      <el-col :span="10">
        <el-form-item
          label="初级水平"
          prop="languageThirdScoring"
          :rules="[
            { required: true, message: '内容不能为空' },
            { type: 'number', message: '内容必须为数字值' },
          ]"
        >
          <el-input
            v-model.number="basicinfoData.languageThirdScoring"
            placeholder="请输入分值"
            autocomplete="off"
            clearable
          ></el-input>
        </el-form-item>
        <span class="spanStyle">分</span>
      </el-col>

      <div class="mbo">
        <h3>技术等级分值设定</h3>
        <hr />
      </div>
      <el-col :span="7">
        <el-form-item
          label="高级水平"
          prop="technologyFristScoring"
          :rules="[
            { required: true, message: '内容不能为空' },
            { type: 'number', message: '内容必须为数字值' },
          ]"
        >
          <el-input
            v-model.number="basicinfoData.technologyFristScoring"
            placeholder="请输入分值"
            autocomplete="off"
            clearable
          ></el-input>
        </el-form-item>
        <span class="spanStyle">分</span>
      </el-col>
      <el-col :span="7">
        <el-form-item
          label="中级水平"
          prop="technologySecondScoring"
          :rules="[
            { required: true, message: '内容不能为空' },
            { type: 'number', message: '内容必须为数字值' },
          ]"
        >
          <el-input
            v-model.number="basicinfoData.technologySecondScoring"
            placeholder="请输入分值"
            autocomplete="off"
            clearable
          ></el-input>
        </el-form-item>
        <span class="spanStyle">分</span>
      </el-col>
      <el-col :span="10">
        <el-form-item
          label="初级水平"
          prop="technologyThirdScoring"
          :rules="[
            { required: true, message: '内容不能为空' },
            { type: 'number', message: '内容必须为数字值' },
          ]"
        >
          <el-input
            v-model.number="basicinfoData.technologyThirdScoring"
            placeholder="请输入分值"
            autocomplete="off"
            clearable
          ></el-input>
        </el-form-item>
        <span class="spanStyle">分</span>
      </el-col>
      <div class="mbo">
        <h3>学历分值设定</h3>
        <hr />
      </div>
      <el-col :span="7">
        <el-form-item
          label="研究生"
          prop="degreeFristScoring"
          :rules="[
            { required: true, message: '内容不能为空' },
            { type: 'number', message: '内容必须为数字值' },
          ]"
        >
          <el-input
            v-model.number="basicinfoData.degreeFristScoring"
            placeholder="请输入分值"
            autocomplete="off"
            clearable
          ></el-input>
        </el-form-item>
        <span class="spanStyle">分</span>
      </el-col>
      <el-col :span="7">
        <el-form-item
          label="本科"
          prop="degreeSecondScoring"
          :rules="[
            { required: true, message: '内容不能为空' },
            { type: 'number', message: '内容必须为数字值' },
          ]"
        >
          <el-input
            v-model.number="basicinfoData.degreeSecondScoring"
            placeholder="请输入分值"
            autocomplete="off"
            clearable
          ></el-input>
        </el-form-item>
        <span class="spanStyle">分</span>
      </el-col>
      <el-col :span="10">
        <el-form-item
          label="专科以下"
          prop="degreeThirdScoring"
          :rules="[
            { required: true, message: '内容不能为空' },
            { type: 'number', message: '内容必须为数字值' },
          ]"
        >
          <el-input
            v-model.number="basicinfoData.degreeThirdScoring"
            placeholder="请输入分值"
            autocomplete="off"
            clearable
          ></el-input>
        </el-form-item>
        <span class="spanStyle">分</span>
      </el-col>
      <div class="mbo">
        <h3>额外加分项设定</h3>
        <hr />
      </div>
      <el-col :span="7">
        <el-form-item
          label="掌握一种语种"
          prop="languageSumSThirdScoring"
          :rules="[
            { required: true, message: '内容不能为空' },
            { type: 'number', message: '内容必须为数字值' },
          ]"
        >
          <el-input
            v-model.number="basicinfoData.languageSumSThirdScoring"
            placeholder="请输入分值"
            autocomplete="off"
            clearable
          ></el-input>
        </el-form-item>
        <span class="spanStyle">分</span>
      </el-col>
      <el-col :span="7">
        <el-form-item
          label="掌握两种语种"
          prop="languageSumSecondIScoring"
          :rules="[
            { required: true, message: '内容不能为空' },
            { type: 'number', message: '内容必须为数字值' },
          ]"
        >
          <el-input
            v-model.number="basicinfoData.languageSumSecondIScoring"
            placeholder="请输入分值"
            autocomplete="off"
            clearable
          ></el-input>
        </el-form-item>
        <span class="spanStyle">分</span>
      </el-col>
      <el-col :span="10">
        <el-form-item
          label="掌握三种及以上"
          prop="languageSumFristScoring"
          :rules="[
            { required: true, message: '内容不能为空' },
            { type: 'number', message: '内容必须为数字值' },
          ]"
        >
          <el-input
            v-model.number="basicinfoData.languageSumFristScoring"
            placeholder="请输入分值"
            autocomplete="off"
            clearable
          ></el-input>
        </el-form-item>
        <span class="spanStyle">分</span>
      </el-col>

      <el-form-item>
        <el-button type="primary" @click="EvaluationFun">确定</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
import { BasicInfoEvaluation, BasicInfoscore } from "@network/api/score.js";
export default {
  data() {
    return {
      formInline: {
        user: "",
      },
      basicinfoData: {
        degreeFristId: 10,
        degreeFristScoring: "",
        degreeSecondId: 11,
        degreeSecondScoring: "",
        degreeThirdId: 12,
        degreeThirdScoring: "",
        hiretimeFirst: "",
        hiretimeFirstId: 1,
        hiretimeFirstScoring: "",
        hiretimeSecondId: 2,
        hiretimeSecondL: "",
        hiretimeSecondScoring: "",
        hiretimeSecondU: "",
        hiretimeThird: "",
        hiretimeThirdId: 3,
        hiretimeThirdScoring: "",
        languageFristId: 4,
        languageFristScoring: "",
        languageSecondId: 5,
        languageSecondScoring: "",
        languageSumFristId: 13,
        languageSumFristScoring: "",
        languageSumSThirdScoring: "",
        languageSumSecondIId: 14,
        languageSumSecondIScoring: "",
        languageSumThirdId: 15,
        languageThirdId: 6,
        languageThirdScoring: "",
        technologyFristId: 7,
        technologyFristScoring: "",
        technologySecondId: 8,
        technologySecondScoring: "",
        technologyThirdId: 9,
        technologyThirdScoring: "",
      },
    };
  },
  methods: {
    async EvaluationFun() {
      let res = await BasicInfoEvaluation(this.basicinfoData);
      let { code, message } = res.data;
      if (code && code == 200) {
        this.$message({
          message: "基础信息评价标准设置成功！",
          type: "success",
        });
      }
    },
    async BasicInfoFun() {
      let resBasicInfoscore = await BasicInfoscore();
      console.log(
        "resBasicInfoscore",
        resBasicInfoscore.data.data.allEvaluation
      );
      resBasicInfoscore.data.data.allEvaluation.forEach((element) => {
        switch (element.scoringId) {
          case 1:
            this.basicinfoData.hiretimeFirst =Number(element.beiyong1);
            this.basicinfoData.hiretimeFirstScoring = element.scoringScore;
            break;
          case 2:
            this.basicinfoData.hiretimeSecondL =Number(element.beiyong1);
            this.basicinfoData.hiretimeSecondU = element.beiyong2;
            this.basicinfoData.hiretimeSecondScoring = element.scoringScore;
            break;
          case 3:
            this.basicinfoData.hiretimeThird = element.beiyong2;
            this.basicinfoData.hiretimeThirdScoring = element.scoringScore;
            break;
          case 4:
            this.basicinfoData.languageFristScoring = element.scoringScore;
            break;
          case 5:
            this.basicinfoData.languageSecondScoring = element.scoringScore;
            break;
          case 6:
            this.basicinfoData.languageThirdScoring = element.scoringScore;
            break;
          case 7:
            this.basicinfoData.technologyFristScoring = element.scoringScore;
            break;
          case 8:
            this.basicinfoData.technologySecondScoring = element.scoringScore;
            break;
          case 9:
            this.basicinfoData.technologyThirdScoring = element.scoringScore;
            break;
          case 10:
            this.basicinfoData.degreeFristScoring = element.scoringScore;
            break;
          case 11:
            this.basicinfoData.degreeSecondScoring = element.scoringScore;
            break;
          case 12:
            this.basicinfoData.degreeThirdScoring=element.scoringScore;
            break;
            case 13:
                this.basicinfoData.languageSumFristScoring=element.scoringScore;
                break;
            case 14:
               this.basicinfoData.languageSumSecondIScoring=element.scoringScore;
               break;
            case 15:
               this.basicinfoData.languageSumSThirdScoring=element.scoringScore;
               break;
      
        }
      });
    },
  },
  created() {
    this.BasicInfoFun();
  },
};
</script>

<style>
.basicdata {
  background-color: #fff;
  padding: 40px 20px;
}
.spanStyle {
  margin-left: 3px;
  display: inline-block;
  height: 41px;
  line-height: 41px;
}
.demo-form-inline {
  margin-top: 30px;
}
.mbo {
  margin-bottom: 30px;
}
</style>